package com.muchfish.reactor.api;

import reactor.core.publisher.Flux;
import reactor.core.scheduler.Schedulers;

public class ReactorParallelExample {
    public static void main(String[] args) throws InterruptedException {
        Flux.range(1, 10)
                .parallel()
                .runOn(Schedulers.parallel())
                .map(x -> x * x)
                .sequential()
                .subscribe(System.out::println);
        //睡一会，等待任务执行完成
        Thread.sleep(1111);
    }
}
